<?php
declare(strict_types=1);

namespace app\admin\service;

use app\admin\model\OfficialMessage as OfficialMessageModel;

class OfficialMessageService
{
    /**
     * 官方消息列表
     * @param $where
     * @param $page
     * @param $limit
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getOfficialMessageList($where, $page, $limit)
    {
        return OfficialMessageModel::getOfficialMessageList($where, $page, $limit);
    }

    /**
     * 官方消息总数
     * @param $where
     * @return int
     */
    public static function countOfficialMessageList($where)
    {
        return OfficialMessageModel::countOfficialMessage($where);
    }

    /**
     * 指定官方消息
     * @param $where
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function findOfficialMessage($where)
    {
        return OfficialMessageModel::findOfficialMessage($where);
    }

    /**
     * 添加官方消息
     * @param $data
     * @return \app\admin\model\Article|\think\Model
     */
    public static function createOfficialMessage($data)
    {
        return OfficialMessageModel::createOfficialMessage($data);
    }

    /**
     * 更新官方消息
     * @param $data
     * @param $where
     * @return OfficialMessageModel
     */
    public static function updateOfficialMessage($data, $where)
    {
        return OfficialMessageModel::updateOfficialMessage($data, $where);
    }
}